<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="/css/style.css?version=<?php echo $version?>" rel="stylesheet" />
<title>综合管理平台</title>
<script language="javascript" src="/js/jquery-1.11.1.min.js"></script>
<script language="javascript" src="/js/manager.js?version=<?php echo $version?>"></script>
<script language="javascript" src="/js/base.js?version=<?php echo $version?>"></script>
</head>
<body>
<div class="mG_main">
	<!-- main -->
    <div class="mG_module">
          <div class="findlist">
          	<form action="" method="get" id="admin_search_type_form">
          	<table class="tablist">
            	<tr>
                    <td class="td1" ><table>
                    	<tbody><tr>
                        	<th>搜索：</th>
                        	<td colspan="2">
                        		<span>
                        		<select name="type"><option value="0">分类</option><?php if ($all_type){foreach ($all_type as $_key => $_type){$is_selected = ($_key == $type) ? 'selected' : '';echo '<option value="'.$_key.'" '.$is_selected.'>'.$_type.'</option>';}}?></select>
                        		<input type="text" name="keyword" value="<?php echo $search_item['keyword']?>" id="admin_search_value"/>
                        		</span>
                        	</td>
                        	<td class="tdbtn">&nbsp;&nbsp;<input type="submit" value=" 搜 索 "></td>
                        </tr>
                    </tbody></table></td>
              </tr>
            </table>
            </form>
            <div style="width: 100%; text-align: right; padding-bottom: 5px;">
            	<a href="javasctipt: void(0)" id="sync_keyword">同步关键词到分词字典</a>
            	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            	<input type="button" value=" 添 加 " id="add_button" />
            </div>
          </div>

        <div class="user_list">
        <table cellspacing="0" cellpadding="0" class="common_table">
                <colgroup>
                    <col width="15%">
                    <col width="5%">
                    <col width="20%">
                    <col width="5%">
                    <col width="*">
                    <col width="10%">
                    <col width="10%">
                </colgroup>
                <thead>
                    <tr>
                        <th>规则名</th>
                        <th>分类</th>
                        <th>关键字</th>
                        <th>回复类型</th>
                        <th>回复内容</th>
                        <th>时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                	<?php foreach ($autoreply_list as $item){?>
					<tr>
						<td style="word-wrap:break-word"><?php echo $item['rule_name']?></td>
						<td><?php echo $item['type']?></td>
                        <td><?php echo !empty($item['keywords']) ? implode(',', $item['keywords']) : ''?></td>
						<td><?php echo $item['material_type']?></td>
						<td><?php echo $item['content']?></td>
						<td><?php echo $item['add_time']?></td>
						<td>
							<a href="/autoreply/edit?id=<?php echo $item['id']?>">修改</a><span class="split"></span>
							<a href="javascript:void(0);" class="rmid" rmid="<?php echo $item['id']?>">移除</a>
						</td>
                    </tr>
                    <?php }?>
                </tbody>
            </table>
        <div class="page_selector">
			<a href="#">第一页</a> | 
			<a href="#">上一页</a> | 
			<a href="#">下一页</a>
        </div>
    </div>
        </div>
        <!-- /main-->
        <div class="clearit"></div>
	  </div>
	  
<script type="text/javascript">
$(document).ready(function(){
	$("#add_button").click(function(){
		window.location.href = '/autoreply/edit/';
	});
	$(".rmid").click(function(){
		if(confirm("确认删除？")){
			window.location.href = '/autoreply/del?id=' + $(this).attr("rmid");
		}
	});
	$("#sync_keyword").click(function(){
		var confirm_str = '确定同步？';
		if (confirm(confirm_str)){
			$.getJSON("/apireceiver/scwsdisc", function(redata) {
				if (redata.code == 0){
					alert('成功！');
				}else{
					alert(redata.msg);
				}
			});
		}
		return false;
	});
});
</script>

</body>
</html>
